﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="database.DAO, golf.Character, golf.Model"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>캐릭터 관리</title>

<SCRIPT LANGUAGE="JavaScript">
<!--
	function go_URL(url)
	{
        location.href = url;
	}
//-->
</SCRIPT>

</head>

<%
	request.setCharacterEncoding("utf-8");
	DAO dao = DAO.getInstance();
	String accountID = (String)session.getAttribute("accountID");
	int serverNo = (Integer)session.getAttribute("serverNo");
	Character[] characters = dao.getCharacterList(accountID, serverNo);
%>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<h1>캐릭터 관리</h1>
	<h3>캐릭터 삭제/승급시험/스탯 찍기</h3>
	<%if(characters != null){ %>
	<form name="form1" method="post" action="../post/postDeleteCharacter.jsp">
	    <table cellspacing="0" width="80%" border="1" bordercolordark="white" bordercolorlight="black">
	        <tr>
	            <td width="100"><span style="font-size:9pt;">캐릭터이름</span></td>
	            <td width="50"><span style="font-size:9pt;">경험치</span></td>
	            <td width="50"><span style="font-size:9pt;">엔지</span></td>
	            <td width="30"><span style="font-size:9pt;">레벨</span></td>
	            <td width="30"><span style="font-size:9pt;">피로도</span></td>
	            <td width="30"><span style="font-size:9pt;">파워</span></td>
	            <td width="30"><span style="font-size:9pt;">임팩트</span></td>
	            <td width="30"><span style="font-size:9pt;">기술</span></td>
	            <td width="30"><span style="font-size:9pt;">체력</span></td>
	            <td width="30"><span style="font-size:9pt;">남은스탯</span></td>
	            <td width="30"><span style="font-size:9pt;">평균타수</span></td>
	            <td width="30"><span style="font-size:9pt;">평균퍼팅수</span></td>
	            <td width="30"><span style="font-size:9pt;">최근평균핸디캡</span></td>
	            <td width="30"><span style="font-size:9pt;">홀인원횟수</span></td>
	            <td width="30"><span style="font-size:9pt;">최고비거리</span></td>
	            <td width="100"><span style="font-size:9pt;">캐릭터등급이름</span></td>
	            <td width="100"><span style="font-size:9pt;">모델이름</span></td>
	            <td width="100"><span style="font-size:9pt;">승급시험여부</span></td>
	            <td width="15"><span style="font-size:9pt;">대상선택</span></td>
	            
	        </tr>
	      <%
	      for(int i = 0; i < characters.length; i++ ){
	      %>	
	        <tr>
	        	<td width="100"><span style="font-size:9pt;"><%=characters[i].getName() %></span></td>
	            <td width="50"><span style="font-size:9pt;"><%=characters[i].getExp() %></span></td>
	            <td width="50"><span style="font-size:9pt;"><%=characters[i].getEnzi() %></span></td>
	            <td width="15"><span style="font-size:9pt;"><%=characters[i].getLevel() %></span></td>
	            <td width="15"><span style="font-size:9pt;"><%=characters[i].getTired() %></span></td>
	            <td width="15"><span style="font-size:9pt;">
	            <a href="../post/postIncreaseCharacterStatus.jsp?charNo=<%=characters[i].getNo()%>&power=1&impact=0&tech=0&stamina=0" target="detail">
	            <%=characters[i].getProperty().getPower() %></a></span></td>
	            <td width="15"><span style="font-size:9pt;">
	            <a href="../post/postIncreaseCharacterStatus.jsp?charNo=<%=characters[i].getNo()%>&power=0&impact=1&tech=0&stamina=0" target="detail">
	            <%=characters[i].getProperty().getImpact() %></a></span></td>
	            <td width="15"><span style="font-size:9pt;">
	            <a href="../post/postIncreaseCharacterStatus.jsp?charNo=<%=characters[i].getNo()%>&power=0&impact=0&tech=1&stamina=0" target="detail">
	            <%=characters[i].getProperty().getTechnique() %></a></span></td>
	            <td width="15"><span style="font-size:9pt;">
	            <a href="../post/postIncreaseCharacterStatus.jsp?charNo=<%=characters[i].getNo()%>&power=0&impact=0&tech=0&stamina=1" target="detail">
	            <%=characters[i].getProperty().getStamina() %></a></span></td>
	            <td width="30"><span style="font-size:9pt;"><%= characters[i].getStat_point()%></span></td>
	            <td width="15"><span style="font-size:9pt;"><%=characters[i].getAvg_stroke_no() %></span></td>
	            <td width="15"><span style="font-size:9pt;"><%=characters[i].getAvg_putting_no() %></span></td>
	            <td width="15"><span style="font-size:9pt;"><%=characters[i].getRecent_avg_hand() %></span></td>
	            <td width="15"><span style="font-size:9pt;"><%=characters[i].getHoleinone_cnt() %></span></td>
	            <td width="15"><span style="font-size:9pt;"><%=characters[i].getHigh_distance() %></span></td>
	            <td width="100"><span style="font-size:9pt;"><%=characters[i].getGrade().getName() %></span></td>
	            <td width="100"><span style="font-size:9pt;"><%=characters[i].getModel().getName() %></span></td>
	            <td width="100"><span style="font-size:9pt;">
	            <a href="../post/postCharacterPassTest.jsp?charNo=<%=characters[i].getNo()%>" target="detail">
	            <%=characters[i].getPassTest() %></a></span></td>
	            <td width="15"><span style="font-size:9pt;"><input type="radio" name="deleteChar" id="1" value="<%=characters[i].getNo() %>"></span></td>
	        </tr>
	      <%}%>
	        
	
	    </table>
	    <input type="submit" name="action" value="캐릭터 삭제">
	</form>
	<h3>캐릭터 추가</h3>
	<%}
 	if(characters != null && characters.length >= 3){
	  out.println("캐릭터는 최대 3개까지 생성할 수 있으므로, 현재 고객님은 캐릭터를 더이상 만들 수 없습니다..");
  	}
 	else{
 		Model[] models = dao.getModelList();
  	%>  
	
    
    <form name="form2" method="post" action="../post/postCreateCharacter.jsp">
	    <table cellspacing="0" width="80%" border="1" bordercolordark="white" bordercolorlight="black">
	        <tr>
	            <td width="100"><span style="font-size:9pt;">캐릭터이름</span></td>
	            <td width="200"><span style="font-size:9pt;"><input type="text" name="charName"></span></td>
	        </tr>
	        <tr>
	        	
	            <td width="100"><span style="font-size:9pt;">모델선택</span></td>
	            <td width="700"><span style="font-size:9pt;">
		            <table cellspacing="0" border="1" bordercolordark="white" bordercolorlight="black">
		        		<tr>
		        			<td width="100">모델명</td>
		        			<td width="50">성별</td>
		        			<td width="30">신장</td>
		        			<td width="20">힘</td>
		        			<td width="20">임팩트</td>
		        			<td width="20">기술</td>
		        			<td width="20">체력</td>
		        			<td width="400">설명</td>
		        			<td width="20">선택</td>
		    			</tr>
	    			 	<%for( int i = 0; i < models.length; i++ ){ %>
		    			<tr>
		    				<td width="100"><%=models[i].getName() %></td>
		        			<td width="50"><%=models[i].getName() %></td>
		        			<td width="30"><%=models[i].getHeight() %></td>
		        			<td width="20"><%=models[i].getProperty().getPower() %></td>
		        			<td width="20"><%=models[i].getProperty().getImpact() %></td>
		        			<td width="20"><%=models[i].getProperty().getTechnique() %></td>
		        			<td width="20"><%=models[i].getProperty().getStamina() %></td>
		        			<td width="400"><%=models[i].getDescription() %></td>
		        			<td width="400"><input type="radio" name="modelNo" id="modelNo" value="<%=models[i].getNo() %>"></td>
		    			</tr>	
		    			<%} %>
		        	</table>
				</td>
	        </tr>
	        <tr>
	            <td width="229" height="19"><span style="font-size:9pt;"><input type="submit" name="action" value="캐릭터 생성"></span></td>
	            <td width="458" height="19"><span style="font-size:9pt;">&nbsp;</span></td>
	        </tr>
	    </table>
    </form>
	<%}%>
  
</body>

</html>